<!DOCTYPE html>
<html>
	<head>
		<meta charset="UTF-8">
		<title>添加BOM信息</title>
		<link rel="stylesheet" type="text/css" href="../../css/style.css"/>
		<link rel="stylesheet" type="text/css" href="../../css/form.css"/>
	</head>
	<body>
		<!-- 蓝色背景区域 -->
		<div class="wrap">
			<!-- 白色可用区域 -->
			<div class="canuse">
				<!------ 位置 ------>
	            <p class="contentText local"><span>位置：基础数据管理 > BOM信息管理 > 添加BOM信息</span></p>
	            
			    	<div class="article_list" style="width: 98.5%; margin: 0px auto;">
			            <!------- 内容 ------->
			            <div class="table_border">
			                <!-- 用户列表内容区 -->
			                <div class="show_list">
			                    <!-- 表单信息填写区 -->
			                    <div class="title_operate">
									<h4 class="sel_title">
                                        <img src="../../img/list/brand1.png" /><span>填写BOM信息信息</span>
                                        <span class="necessary">（带*号为必填项）</span>
                                    </h4>
									<div class="operate_area" id="addOperate">
										<!--<a id="addCommonProcess" onclick="addCommonTechnology()" class="bgd_add img_hand" style="width: 120px;background-color: white;border-radius: 5px;">添加通用工艺</a>-->
										<a id="addDetail" onclick="addDetail()" class="bgd_add img_hand">增加</a>
										<a class="bgd_delete img_hand">删除</a>
									</div>
								</div>
		                    	<div class="info_area">
									<table class="tablelist" border="1" cellspacing="0" cellpadding="0">
										<tbody>
											<tr class="menuText list_head">
												<th class="">工序BOM名称</th>
												<th class="">产品代号</th>
												<th class="">零部件号</th>
												<th class="">工艺编号</th>
												<th class="">工艺版本</th>
											</tr>
										</tbody>
										<tbody class="tablelist">
											<tr class="listTableText list_list">
												<td><input type="text" class="" name="" id="" value=""><span style="color:red;" >*</span></td>
												<td><input type="text" class="" name="" id="" value=""><span style="color:red;" >*</span></td>
												<td><input type="text" class="" name="" id="" value=""><span style="color:red;" >*</span></td>
												<td><input type="text" class="" name="" id="" value=""><span style="color:red;" >*</span></td>
												<td><input type="text" class="" name="" id="" value=""><span style="color:red;" >*</span></td>
											</tr>
										</tbody>
									</table>
								</div>
								<div class="info_area">
									<table class="tablelist" border="1" cellspacing="0" cellpadding="0">
										<tbody>
											<tr class="menuText list_head">
												<tr class="menuText list_head">
													<th class="checkSelectAll"></th>
													<th class="">序号</th>
													<th class="">物料编号</th>
													<th class="">工序号</th>
													<th class="">工序名称</th>
													<th class="">物料名称</th>
													<th class="">装配数量</th>
													<th class="">单位</th>
													<th class="">规格型号</th>
													<th class="">物料类型</th>
													<th class="">密级</th>
													<th class="">备注</th>
												</tr>
										</tbody>
										<tbody class="tablelist" id="EBOMDetail">
										</tbody>
									</table>
								</div>
		                    	
		                        <!-- 保存、重置按钮区 -->
		                        <div align="center" class="btn_submit">
		                            <a href="BOMInfo.html" class="bgd_blue_two img_hand contentText">保存</a>
		                            <a href="BOMInfo.html" class="bgd_white_two img_hand"> 返回 </a>
		                        </div>
			                </div>
			            </div>
			            
			        </div>
				</div>
	            
			</div>
			
			<!-- 版尾  -->
			<div class="ending">
				 Copyright© 2019-2020 磐基技术有限公司
		</div>
	</body>
	<script src="../../js/jquery-3.1.1.min.js" type="text/javascript" charset="utf-8"></script>
	<script type="text/javascript">
		var h = document.documentElement.clientHeight;
		$(".wrap").css("height", h);
		
		// 获取每行 td 的兄弟节点
		$(".info_area td").hover(   
			function () {      
				$(this).parent().children().addClass("td_hover");   
			},    
			function () {      
				$(this).parent().children().removeClass("td_hover");   
			}
		);
		
		function addDetail() {
		trInt = getMaxId();
		
		var dom = "";
		dom += "<tr class='contentText list_list' id='"+ (trInt) +"'>";
		dom += "<td class='checkBox2item'><input type='checkbox' class='input_checkBox' ></td>";
		dom += "<td ><input class='serialNo' id='serialNo"+ (trInt) +"' name = 'commonProessTemplates["+ (trInt) +"].serialNo' value='"+ getMaxSerialNo() +"' ><span style='color:red;' >*</span></td>";
		dom += "<td><div  class='addRemind1'><input class = "+ (trInt) +" type='text' name='commonProessTemplates[" + (trInt) + "].processCode' value=''><span style='color:red;' >*</span></div></td>";// onchange='inventorySupplyAdd.complement(value,"+trInt+" )'
		dom += "<td><div  class='addRemind1'><input class = "+ (trInt) +" type='text' name='commonProessTemplates[" + (trInt) + "].processName' value=''><span style='color:red;' >*</span></div></td>";// onchange='inventorySupplyAdd.complement(value,"+trInt+" )'
		
		dom += "<td><div  class='addRemind1'><input class = "+ (trInt) +" type='text' name='commonProessTemplates[" + (trInt) + "].processCode' value=''><span style='color:red;' >*</span></div></td>";// onchange='inventorySupplyAdd.complement(value,"+trInt+" )'
		
		dom += "<td><div  class='addRemind1'><input class = "+ (trInt) +" type='text' name='commonProessTemplates[" + (trInt) + "].processCode' value=''><span style='color:red;' >*</span></div></td>";// onchange='inventorySupplyAdd.complement(value,"+trInt+" )'
		dom += "<td><div  class='addRemind1'><input class = "+ (trInt) +" type='text' name='commonProessTemplates[" + (trInt) + "].processCode' value=''><span style='color:red;' >*</span></div></td>";// onchange='inventorySupplyAdd.complement(value,"+trInt+" )'
		dom += "<td><div  class='addRemind1'><input class = "+ (trInt) +" type='text' name='commonProessTemplates[" + (trInt) + "].processCode' value=''><span style='color:red;' >*</span></div></td>";// onchange='inventorySupplyAdd.complement(value,"+trInt+" )'
		dom += "<td><div  class='addRemind1'><input class = "+ (trInt) +" type='text' name='commonProessTemplates[" + (trInt) + "].processCode' value=''><span style='color:red;' >*</span></div></td>";// onchange='inventorySupplyAdd.complement(value,"+trInt+" )'
		dom += "<td><div  class='addRemind1'><input class = "+ (trInt) +" type='text' name='commonProessTemplates[" + (trInt) + "].processCode' value=''><span style='color:red;' >*</span></div></td>";// onchange='inventorySupplyAdd.complement(value,"+trInt+" )'
		dom += "<td><div  class='addRemind1'><select><option>秘密</option><option>机密</option><option>绝密</option></select></div></td>";// onchange='inventorySupplyAdd.complement(value,"+trInt+" )'
		dom += "<td><div  class='addRemind1'><input class = "+ (trInt) +" type='text' name='commonProessTemplates[" + (trInt) + "].processCode' value=''><span style='color:red;' >*</span></div></td>";// onchange='inventorySupplyAdd.complement(value,"+trInt+" )'
		
		dom += "</tr>";
		$("#EBOMDetail").append(dom);
	}
		
		function getMaxId(){
		var maxId = 0;
		var trList = $("#tablelist").find("tr");
		if(trList.length > 0){
			$.each(trList, function(index, obj){
				var id = parseInt($(obj).attr("id"));
				if(maxId < (id +1)){
					maxId = id + 1;
				}
			});
		}
		return maxId;
	}
		
		//获取当前序号最大值+1
	function getMaxSerialNo(){
		var trList = $("#tablelist").find("tr");
		var len = $("#tablelist").find("tr").length;
		if(len > 0){
			var maxSerial = trList[len-1].cells[1].childNodes[0].value;
			if(null != maxSerial){
				return parseInt(maxSerial)+1;
			}
			return len;
		}
		return 1;
	}
	
	</script>
</html>
